package com.itqf.service.impl;

import com.itqf.bean.DtsOrderGoodsExample;
import com.itqf.mapper.DtsOrderGoodsMapper;
import com.itqf.service.DtsOrderGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * projectName: gp_manage
 *
 * @author: 赵伟风
 * time: 2021/8/24 0:06
 * description:
 */
@Service
public class DtsOrderGoodsServiceImpl  implements DtsOrderGoodsService {

    @Autowired
    private DtsOrderGoodsMapper dtsOrderGoodsMapper;

    /**
     * 查询订单中是否有商品使用
     *
     * @param id
     * @return
     */
    @Override
    public boolean checkExist(Integer id) {

        DtsOrderGoodsExample example = new DtsOrderGoodsExample();

        DtsOrderGoodsExample.Criteria criteria = example.createCriteria();

        criteria.andGoodsIdEqualTo(id);

        long count = dtsOrderGoodsMapper.countByExample(example);

        return count >0;
    }
}
